<?php include_once("connection.php"); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!--
Design by Free CSS Templates
http://www.freecsstemplates.org
Released for free under a Creative Commons Attribution 2.5 License

Name       : Personal Description: A two-column, fixed-width design.
Version    : 1.0
Released   : 20080513

-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript">
function control(){
		var a=document.getElementById('title').value;
		var b=document.getElementById('context').value;
		if(a.length==0 || b.length==0){
			alert("title veya context eksik");
			return false;
		}
		else{
			return true;
		}
}
</script>
<?php 
		$mode = 0;
		if(strlen($_GET["edit"])!=0){
			$sonuc = mysql_query("select title,context from tbl_post where post_id='".$_GET["edit"]."'");
			$sutun = mysql_fetch_assoc($sonuc);
			$mode = $_GET["edit"];
		}
		
	mysql_close($con);
?>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Bahar Çağlar's Personal Web Page</title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<link href="style.css" rel="stylesheet" type="text/css" media="screen" />
</head>
<body>
<!-- start header -->
<div id="header">
	<?php include_once("header.php"); ?>
</div>
<!-- end header -->
<!-- start page -->
<div id="wrapper">
	<div id="page">
				<!-- start content -->
				<div id="content">
				 		 <div class="post">
                         <table>
                             <form method="post" action="index.php" onsubmit="return control();">
                                   <tr>
                             		<td><label for="title"> Title :</label></td>
                                    <td> <input type="text" name="title" id="title" value="<?php if($mode!=0){echo $sutun["title"];}?>" /></td>
                                    </tr>
                                   <tr>
                                   <td> <label for="context">Context :</label></td>
                                    <td><textarea name="context" id= "context" ><?php if($mode!=0){echo $sutun["context"];}?></textarea></td>
                                    
                                    </textarea>
                                    </tr>
                                    <tr><td colspan="2" align="right"><input type="submit" value="<?php if($mode!=0){echo "edit";}
									else{echo "send";} ?>" /></td>
                                    </tr>
                                    <input type="hidden" name="mode" id="mode" value="<?php echo $mode; ?>" />
                             </form>
                         </table>
						 
					     </div>
				</div>
				<!-- end content -->
				<!-- start sidebar -->
				<div id="sidebar">
				<?php include_once("sitebar.php"); ?>
				</div>
				<!-- end sidebar -->
				<div style="clear:both">&nbsp;</div>
	</div>
</div>
<div id="footer">
	<?php include_once("footer.php"); ?>
</div>
</body>
</html>
